package com.manage.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 操作日志对象 cm_sys_operation_log
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Data
@TableName("cm_sys_operation_log")
public class CmSysOperationLog
{
    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 外部唯一id */
    private String publicId;

    /** 操作类型：INSERT（新增）、UPDATE（修改）、DELETE（删除）、SELECT（查询）、EXPORT（导出）、LOGIN（登录） */
    private String operationType;

    /** 数据库表 */
    private String operationTarget;

    /** 数据库表主键 */
    private String targetId;

    /** 操作描述 */
    private String operationDescription;

    /** 修改前数据 */
    private String oldData;

    /** 修改后数据 */
    private String newData;

    /** 操作人ID */
    private Long operatorId;

    /** 操作人姓名 */
    private String operatorName;

    /** 操作人IP */
    private String operatorIp;

    /** 操作设备 */
    private String operatorDevice;

    /** 扩展信息 */
    private String extendedInfo;

    /** 操作时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date operationTime;

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("publicId", getPublicId())
            .append("operationType", getOperationType())
            .append("operationTarget", getOperationTarget())
            .append("targetId", getTargetId())
            .append("operationDescription", getOperationDescription())
            .append("oldData", getOldData())
            .append("newData", getNewData())
            .append("operatorId", getOperatorId())
            .append("operatorName", getOperatorName())
            .append("operatorIp", getOperatorIp())
            .append("operatorDevice", getOperatorDevice())
            .append("extendedInfo", getExtendedInfo())
            .append("operationTime", getOperationTime())
            .toString();
    }
}
